<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加联系人 - 学生通讯录系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>学生通讯录系统</h1>
        </header>

        <nav>
            <ul>
                <li><a href="${pageContext.request.contextPath}/listContacts">查看所有联系人</a></li>
                <li><a href="${pageContext.request.contextPath}/addContact">添加联系人</a></li>
                <li><a href="${pageContext.request.contextPath}/index.jsp">返回首页</a></li>
            </ul>
        </nav>

        <main>
            <section class="form-section">
                <h2>添加联系人</h2>

                <c:if test="${not empty message}">
                    <div class="message error">${message}</div>
                </c:if>

                <form action="${pageContext.request.contextPath}/addContact" method="post">
                    <div class="form-group">
                        <label for="studentId">学号（以8开头八位数）：</label>
                        <input type="text" id="studentId" name="studentId" required placeholder="请输入学号">
                    </div>

                    <div class="form-group">
                        <label for="name">姓名：</label>
                        <input type="text" id="name" name="name" required placeholder="请输入姓名">
                    </div>

                    <div class="form-group">
                        <label for="grade">年级：</label>
                        <select id="grade" name="grade">
                            <option value="">请选择年级</option>
                            <option value="大一">大一</option>
                            <option value="大二">大二</option>
                            <option value="大三">大三</option>
                            <option value="大四">大四</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="contactInfo">联系方式（以电话号码格式）：</label>
                        <input type="text" id="contactInfo" name="contactInfo" placeholder="请输入联系方式">
                    </div>

                    <div class="form-group">
                        <button type="submit" class="btn btn-primary">添加</button>
                        <button type="reset" class="btn btn-secondary">重置</button>
                    </div>
                </form>
            </section>
        </main>

        <footer>
            <p> 2025  学生通讯录系统 - 南昌大学共青学院</p>
        </footer>
    </div>
</body>
</html>
